package gomz.res;

import java.util.ArrayList;
import java.util.Date;

import org.simpleframework.xml.Element;
import org.simpleframework.xml.ElementList;

/**
 * @author Schatzmann
 * Diese Klasse enthaelt die Daten, welche fuer die Uebersicht einer Fragestellung benoetigt werden.
 * Dies wird verwendet falls nicht alle Angaben zu einer Fragestellung benoetigt werden
 */

public class QuestionCore {
// ********************************************************************************
// Variablen
// ********************************************************************************

    @Element(required = false)
    private int id = 0;
    @Element(required = false)
    private String title = new String();
    @Element(required = false)
    private String question = new String();
    @Element(required = false)
    private Date edited = new Date();
    @ElementList(required = false)
    private ArrayList<Category> cat = new ArrayList<Category>();
    @Element(required = false)
    private boolean isPublic = false;
    @Element(required = true)
    private UserCore user = new UserCore();
    
// ********************************************************************************
// Getter/Setter
// ********************************************************************************     
    public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getQuestion() {
		return question;
	}

	public void setQuestion(String question) {
		this.question = question;
	}

	public ArrayList<Category> getCat() {
		return cat;
	}

	public void setCat(ArrayList<Category> cat) {
		this.cat = cat;
	}

    public Date getEdited() {
        return edited;
    }

    public void setEdited(Date edited) {
        this.edited = edited;
    }
    
    public boolean isIsPublic() {
        return isPublic;
    }

    public void setIsPublic(boolean isPublic) {
        this.isPublic = isPublic;
    }
    
	public UserCore getUser() {
		return user;
	}

	public void setUser(UserCore user) {
		this.user = user;
	}
        
// ********************************************************************************
// Konstruktor
// ********************************************************************************
	    /**
	     * Konstruktor um eine leere QuestionOverview zu erstellen
	     */
	    public QuestionCore(){

	    }


            /**
	     * Konstruktor um eine QuestionOverview direkt mit den Daten zu fuellen
	     * @param id ID der Question
             * @param title Titel der Question
             * @param question Fragestellung der Question
             * @param cat Categorie Liste in welcher die Question ist
             * @param isPublic ob die Frage fuer alle verfuegbar ist
             * @param user User welchem die Frage gehoert
	     */
	    public QuestionCore(int id, String title, String question, ArrayList<Category> cat, boolean isPublic, UserCore user){
	        this.id = id;
	        this.title = title;
	        this.question = question;
	        this.cat = cat;
	        this.isPublic = isPublic;
	        this.user = user;
	    }
}
